<?php
namespace Home\Controller;
use Think\Controller;
use Common\Wechat\Wechat;
class IndexController extends Controller {
    public function index(){
/*        $weObj = new Wechat(C('WECHART_CONFIG'));
        $weObj->valid();
        $type = $weObj->getRev()->getRevType();
        $ip=$_SERVER["SERVER_NAME"];
        switch($type) {
          //文本消息
            case Wechat::MSGTYPE_TEXT:
                $textStr = $weObj->getRevContent();
                if($textStr=='商城'){
                  $newsData = array(
                      "0"=>array(
                        'Title'=>'首页',
                        'Description'=>'点击进入',
                        'PicUrl'=>'',
                        'Url'=>''
                      ),
                      "1"=>array(
                        'Title'=>'推荐商品',
                        'Description'=>'点击进入',
                        'PicUrl'=>'',
                        'Url'=>''
                      ),
                      "2"=>array(
                        'Title'=>'热门活动',
                        'Description'=>'点击进入',
                        'PicUrl'=>'',
                        'Url'=>''
                      ),
                      );
                  $weObj->news($newsData)->reply();
                }
                
                break;
          //事件消息
           case Wechat::MSGTYPE_EVENT:
                $eventData = $weObj->getRevEvent();

                //关注事件
                if($eventData['event'] == 'subscribe'){
                    $weObj->text('感谢关注')->reply();
                }

                //菜单事件
                if($eventData['event'] == 'CLICK'){
                    //获得EventKey
                    $eventkey = $eventData['key'];
                    $newsData = array();
                    if($eventkey == '微官网'){
                      $newsData = array("0"=>array(
                        'Title'=>'微官网',
                        'Description'=>'点击进入',
                        'PicUrl'=>'',
                        'Url'=>''
                      ));
                        
                    }
                    if($eventkey == '微商城'){
                        $newsData = array("0"=>array(
                          'Title'=>'微商城',
                          'Description'=>'点击进入',
                          'PicUrl'=>'',
                          'Url'=>''
                        ));
                      }

                    $weObj->news($newsData)->reply();
                }
               
               break;


           default:
               $weObj->text("help info")->reply();
        }*/

    }
    
    
}